/*
 * @Author: czy
 * @Date: 2021-04-04 22:39:40
 * @LastEditTime: 2021-04-10 15:33:02
 */
extern unsigned char inb(unsigned short int port_from);
extern void outb(unsigned short int port_to, unsigned char value);

#define uart_base 0x3F8

/**
 * @description: Output a character to the uart.
 * @param c Character to be output.
 */
void uart_put_char(unsigned char c)
{
    outb(uart_base, c);
}

/**
 * @description: Get a character from the uart.
 * @return Character entered.
 */
unsigned char uart_get_char(void)
{
    return inb(uart_base);
}

/**
 * @description: Output a string to the uart.
 * @param str   String to be output.
 */
void uart_put_chars(char *str)
{
    int i = 0;
    do
    {
        outb(uart_base, str[i]);
    } while (str[++i] != '\0');
}